using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace TEST
{
    public class Test_VariableStore : MonoBehaviour
    {

        public int var_int = 0;
        public float var_flt = 0;
        public bool var_bool = false;

        private void Start()
        {
            VariableStore.CreateDatabase("db1");
            VariableStore.CreateDatabase("db2");
            VariableStore.CreateDatabase("db43");
            VariableStore.CreateDatabase("link_db");


            VariableStore.CreateVariabel("L_int", var_int, () => var_int, value => var_int = value);
            VariableStore.CreateVariabel("db1.num1", 0);
            VariableStore.CreateVariabel("db2.num5", 5);
            VariableStore.CreateVariabel("lightIsOn", true);
            VariableStore.CreateVariabel("float1", 0f);
            VariableStore.CreateVariabel("str1", "hello");
            VariableStore.CreateVariabel("str2", "world");

/*            VariableStore.PrintAllDatabases();
            VariableStore.PrintAllVariables();*/
        }

        private void Update()
        {
            if (Input.GetKeyDown(KeyCode.Z))
            {
                VariableStore.TryGetValue("L_int", out object link_integer);
                VariableStore.TrySetValue("L_int", (int)link_integer + 5);
            }

            if (Input.GetKeyDown(KeyCode.X))
            {
                VariableStore.PrintAllDatabases();
                VariableStore.PrintAllVariables();
            }
        }
    }
}